//
//  UIBarButtonItem+category.swift
//  swiftWeiBoDemo
//
//  Created by zzw on 16/3/25.
//  Copyright © 2016年 zzw. All rights reserved.
//

import UIKit
extension UIBarButtonItem{
    
    //func前加上class就是+方法
  class func  createUIBarButtonItem(imageName:String,target:AnyObject?,action:Selector)->UIBarButtonItem{
    
    let btn = UIButton()
    btn.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
    btn.setImage(UIImage(named: imageName + "_highlighted"), forState: UIControlState.Highlighted)
    btn.sizeToFit()
    btn.addTarget(target, action: action, forControlEvents: UIControlEvents.TouchUpInside)
    return  UIBarButtonItem(customView: btn)
    }



}
